package com.module.area;

import java.util.Hashtable;
import java.util.List;

import com.game.base.SimulationObject;
import com.game.manager.SobManager;
import com.game.nonperfomers.Area;

public class AreaManager {
	
	protected static final Hashtable<Integer, Area> areas = new Hashtable<Integer, Area>();
	
	public static void setup(){
		initAreas();
		
	}
	
	/**
	 * 初始化所有的区域
	 */
	protected static void initAreas(){
		String[] filters = new String[1];
		filters[0] = Area.class.getName();
		List<SimulationObject> list = SobManager.get().getChilds(SimulationObject.ROOT, filters);
		areas.clear();
		for(SimulationObject obj : list){
			areas.put(obj.id, (Area)obj);
		}
	}
	
	public static Area createArea(){
		Area area = (Area)SobManager.get().createSob(Area.class.getName(), SimulationObject.ROOT);
		
		return area;
	}
}
